In [1]:
%pylab inline
from classy import *
In [2]:
data=load_excel('data/iris.xls',verbose=True)
In [3]:
print(data.vectors.shape)
print(data.targets)
print(data.target_names)
print(data.feature_names)
since you can't plot 4 dimensions, try plotting some 2D subsets
I don't like the automatic placement of the legend, so lets set it manually
In [4]:
subset=extract_features(data,[0,2])
plot2D(subset,legend_location='upper left')
I don't want to do the classification on this subset, so make sure to use the entire data set.
In [5]:
C=LogisticRegression()
Split the data into test and train subsets...
In [6]:
data_train,data_test=split(data,test_size=0.2)
...and then train...
In [7]:
timeit(reset=True)
C.fit(data_train.vectors,data_train.targets)
print("Training time: ",timeit())
In [8]:
print("On Training Set:",C.percent_correct(data_train.vectors,data_train.targets))
print("On Test Set:",C.percent_correct(data_test.vectors,data_test.targets))
some classifiers have properties that are useful to look at. Naive Bayes has means and stddevs...
In [9]:
C.coef_
Out[9]:
In [ ]: